/*
 * @Description: Vuex getters
 * @Author: wangfuwei
 * @Date: 2020-11-30 17:57:30
 * @LastEditors: wangfuwei
 * @LastEditTime: 2021-04-23 21:30:23
 * @FilePath: /horizon-frontend/src/store/getters.js
 */
import { DEVICE_TYPE } from "@/utils/device";
import { getLanguage } from "@/locales/util";

const getters = {
  logo: state => state.app.logo, //系统logo
  copyright: state => state.app.copyright, //版权信息
  device: state => state.app.device, //设备信息
  primaryColor: state => state.app.primaryColor, //主题色
  colorWeak: state => state.app.colorWeak, //色盲模式
  language: () => getLanguage(), //国际化语言
  token: state => state.user.token, //Token
  username: state => state.user.username, //用户账号
  nickname: state => state.user.nickname, //用户姓名
  avatar: state => state.user.avatar, //用户头像
  dept: state => state.user.dept, //用户部门
  isMobile: state => state.app.device === DEVICE_TYPE.MOBILE, //是否手机
  isTablet: state => state.app.device === DEVICE_TYPE.TABLET, //是否平板
  isDesktop: state => state.app.device === DEVICE_TYPE.DESKTOP, //是否电脑
  globalApps: state => state.menu.globalApps, //全局应用
  lockedApps: state => state.menu.lockedApps, //用户已锁定应用
  cloudApps: state => state.menu.cloudApps, //用户拥有权限的应用
};

export default getters;
